From db1d2781007cb5a9e5ff4d03305743351286da11 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 3 Apr 2023 10:06:18 -0300 Subject: [PATCH] gsk/vulkan/renderpass: Don't scale scissor and render area The rects passed to the clip region are in buffer coordinates, and must not be scaled. Consider the following scenario: Wayland, with a 1024x768@2 window. That gives us a 2048x1536 raw image. To setup the Vulkan render pass code, we'd scale 2048x1536 *again*, to an unreasonable 4196x3072, which is (1) incorrect and (2) really incorrect and (3) can lead to crashes at best, full GPU resets at worst - and a GPU reset is incredibly not fun! Now that we pass the right clip regions at the right coordinates at all times, remove the extra scaling from the render pass. --- gsk/vulkan/gskvulkanrenderpass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index 458d2b1fa4..24432ddd06 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -2258,8 +2258,8 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self, 0, 1, &(VkRect2D) { - { rect.x * self->scale_x, rect.y * self->scale_y }, - { rect.width * self->scale_x, rect.height * self->scale_y } + { rect.x, rect.y }, + { rect.width, rect.height } }); vkCmdBeginRenderPass (command_buffer, @@ -2268,8 +2268,8 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self, .renderPass = self->render_pass, .framebuffer = gsk_vulkan_render_get_framebuffer (render, self->target), .renderArea = { - { rect.x * self->scale_x, rect.y * self->scale_y }, - { rect.width * self->scale_x, rect.height * self->scale_y } + { rect.x, rect.y }, + { rect.width, rect.height } }, .clearValueCount = 1, .pClearValues = (VkClearValue [1]) { -- 2.30.2